-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate CaptureArbitrumStorageGet/Set into the prestate tracer #2602
base: master
Are you sure you want to change the base?
Integrate CaptureArbitrumStorageGet/Set into the prestate tracer #2602
Conversation
…toragegetset-prestatetracer
…toragegetset-prestatetracer
@@ -141,9 +140,16 @@ func TestPrestateTracerArbitrumStorage(t *testing.T) { | |||
hourNow := (time.Now().Unix() - programs.ArbitrumStartTime) / 3600 | |||
hourActivatedFromTrace := arbmath.BytesToUint24(postData[8:11]) | |||
// #nosec G115 | |||
assert(uint64(hourActivatedFromTrace) == uint64(hourNow), nil, "wrong activated time in trace") | |||
if !(uint64(hourActivatedFromTrace) == uint64(hourNow)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: this if is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had left it there thinking it signifies we are looking for equality check (most cases) here. But we kind need to have two checks anyway as we should check if math.Abs(float64(hourActivatedFromTrace)-float64(hourNow))
is either 0 or 1.
This PR implements
CaptureArbitrumStorage[Get]Set
methods forprestateTracer
capturing changes that ArbOS makes to storage outside EVM execution, these weren't picked up by theprestateTracer
before.Arbos
Storage
object callsRecordStorage[Get]Set
functions to capture tracing of reads and writes of key-value pairs, meaning the SLOAD/SSTORE opcodes tracing in these functions during scenarioTracingDuringEVM
has no impact at all as the caller address (scope.Contract) and the key being passed don't associate with each other, instead the key corresponds to types.ArbosStateAddress.To solve this issue, we currently call
CaptureArbitrumStorage[Get]Set
regardless of the tracing scenario and call opcode tracing additionally if the scenario isTracingDuringEVM
to preserve functionality of other tracers that haven't yet implementedCaptureArbitrumStorage...
methods. Notice that SLOAD/SSTORE opcode tracing has no effect on prestate tracer due to the above stated issue and callingCaptureArbitrumStorage...
methods first yields correct results.Pulls in geth- OffchainLabs/go-ethereum#352
Resolves NIT-2733